package com.cn.zpark;

import com.cn.zpark.utils.DBUtils;

import java.sql.Connection;
import java.sql.PreparedStatement;

/**
 * @PackageName: com.cn.zpark
 * @ClassName: JdbcTransactionCreateTbale
 * @Description:
 * @author: RZS
 * @date: 2022/3/31  14:03
 */
public class JdbcTransactionCreateTable {
    public static void main(String[] args) throws Exception {
        Connection conn = null;
        PreparedStatement stat = null;

        // 获取数据库连接对象
        conn = DBUtils.getConn();
        // 创建sql语句
        String sql = "create table tab2(id int primary key auto_increment, " +
                "uname varchar(100) not null unique, money double not null)";
        // 创建PreparedStatement对象
        stat = conn.prepareStatement(sql);
        // 执行sql
        stat.execute();
        // 关闭资源
        DBUtils.close(conn, stat, null);
    }
}
